/*
 * Copyright (c) 2007-2021 西安交通信息投资营运有限公司 版权所有
 */

package com.xci.xajtfb.gjzn.api;

import com.github.lvyanyang.annotation.Authorize;
import com.github.lvyanyang.annotation.RequestJson;
import com.github.lvyanyang.core.BaseController;
import com.github.lvyanyang.core.BoolResult;
import com.github.lvyanyang.core.Const;
import com.xci.xajtfb.gjzn.entity.BusGpsPosition;
import com.xci.xajtfb.gjzn.entity.BusGpsTrack;
import com.xci.xajtfb.gjzn.filter.GpsPositionFilter;
import com.xci.xajtfb.gjzn.filter.GpsTrackFilter;
import com.xci.xajtfb.gjzn.service.GjznService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 公交智能接口
 * @author 吕艳阳 lvyanyang@xci96716.com
 * @since 2021-02-07 14:10:10
 */
@Api(tags = "公交智能接口")
@Authorize
@RestController
@RequestMapping(value = "/api/gjzn", produces = Const.PROJSON)
public class GjznApiController extends BaseController {
    /** 公交智能服务 */
    @Resource private GjznService gjznService;

    @ApiOperation(value = "查询线路信息列表")
    @PostMapping("/selectRouteList")
    public BoolResult<List<Map<String,String>>> selectRouteList(@RequestJson String name) {
        return BoolResult.success(gjznService.selectRouteList(name));
    }

    @ApiOperation(value = "根据线路主键查询车辆列表")
    @ApiImplicitParam(name = "routeId", value = "线路主键", required = true)
    @PostMapping("/selectBusListByRouteId")
    public BoolResult<List<Map<String,String>>> selectBusListByRouteId(@RequestJson String routeId) {
        return BoolResult.success(gjznService.selectBusListByRouteId(routeId));
    }

    @ApiOperation(value = "查询车辆最后Gps位置")
    @PostMapping("/selectBusLastGpsPosition")
    public BoolResult<List<BusGpsPosition>> selectBusLastGpsPosition(@RequestBody GpsPositionFilter filter) {
       return BoolResult.success(gjznService.selectBusLastGpsPosition(filter));
    }

    @ApiOperation(value = "查询车辆Gps轨迹")
    @PostMapping("/selectBusGpsTrack")
    public BoolResult<List<BusGpsTrack>> selectBusGpsTrack(@RequestBody GpsTrackFilter filter) {
       return BoolResult.success(gjznService.selectBusGpsTrack(filter));
    }

}